<template>
	<view class="page-container">
		<ReservoirDetail 
			v-if="basinCode"
			:basin-code="basinCode"
			@refresh="handleRefresh"
		/>
		<view v-else class="empty-state">
			<text class="empty-text">请提供水库编码参数</text>
			<text class="empty-hint">示例: /pages/rainfall/measured?basinCode=YOUR_CODE</text>
		</view>
	</view>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import ReservoirDetail from '@/components/ReservoirDetail.vue'

// 获取URL参数
const basinCode = ref('')

onMounted(() => {
	// 从URL参数获取水库编码
	const pages = getCurrentPages()
	const currentPage = pages[pages.length - 1]
	const options = currentPage.options || {}
	
	basinCode.value = options.basinCode || ''
	
	console.log('雨情实测页面加载，水库编码:', basinCode.value)
})

const handleRefresh = () => {
	console.log('刷新雨情实测数据')
}
</script>

<style scoped>
.page-container {
	min-height: 100vh;
	background: #f5f7fa;
}

.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 80vh;
	padding: 40rpx;
	gap: 20rpx;
}

.empty-text {
	font-size: 32rpx;
	color: #666;
	font-weight: 500;
}

.empty-hint {
	font-size: 24rpx;
	color: #999;
	text-align: center;
	line-height: 1.6;
}
</style>

